<?php
  // no direct access
  defined( '_JEXEC' ) or die( 'Restricted access' );
  jimport( 'joomla.application.component.view');
  
  class ConferenceViewConference extends JView
  {              
    var $_name = "conference";
  
    function display()
    { 
      $this->displayList();
    }
    
    function displayList()
    {
      /* sorting */
      $state =& $this->get( 'state' );
            $lists['order_Dir'] = $state->get($this->_name . 'filter_order_Dir');
            $lists['order']     = $state->get($this->_name . 'filter_order');
            $this->assignRef('lists', $lists);    
    
      $conferences = $this->get('ListData');
      $pagination  = $this->get('Pagination');
      $this->assign('conferences', $conferences);
      $this->assign('pagination', $pagination);
      
      JToolBarHelper::title( JText::_( 'Conferences' ), 'generic.png' );  
      
      JToolBarHelper::publishList();
      JToolBarHelper::unpublishList();
      JToolBarHelper::addNew();
      JToolBarHelper::editList();
      JToolBarHelper::deleteList();
      
      PBNYHelper::createMenu();
      
      parent::display("list");    
    }
    
    function displayAdd()
    {    
      $editor =& JFactory::getEditor();
      $this->assign('editor', $editor);
      
      JToolBarHelper::title( JText::_( 'Add Conference' ), 'generic.png' );
      JToolBarHelper::save();
      JToolBarHelper::cancel();
      
      $team = $this->getModel('team');
      $this->assign('teams', $team->get());

      parent::display("edit");
    }    
    
    function displayEdit()
    {  
      $editor =& JFactory::getEditor();
      $this->assign('editor', $editor);
      
      $cids = JRequest::getVar('cid', null, 'default', 'array' );
      
      $model = $this->getModel('conference');
      $conference = $model->get($cids[0]);
      $this->assign('conference', $conference);
      
      $team = $this->getModel('team');
      $this->assign('teams', $team->get());
      
      $conference_team = $this->getModel('conferenceteam');
      $this->assign('conference_teams', $conference_team->get_by_conference_id($conference->id));
      
      JToolBarHelper::title( JText::_( 'Edit Conference' ), 'generic.png' );
      JToolBarHelper::save();
      JToolBarHelper::cancel();  

      parent::display("edit");
    }    
  }
?>